/*
没有完成，只是定义了Circle和Square类。抛砖英语，你可以模拟这个，照猫画虎，完成其他类的定义。
当然main函数中，也要改成含有5个元素的数组。
*/
#include <iostream>
#include <iomanip>
#define PI 3.14159f
using namespace std;
class Shape
{
    public:
        Shape()
        {
        
        }
        virtual float area()
        {
         return 0;
        }
};
class Circle : public Shape
{
    public:
        float r;
        Circle(float pr)
        {
         r=pr;
        }
        float area()
        {
         return r * r * PI;
        } 
};
class Square : public Shape
{
    public:
        float e;
        Square(float pe)
        {
         e=pe;
        }
        float area()
        {
         return e*e;
        }
};
class Rectangle : public Shape
{
    public:
        float ch;
        float k;
        Rectangle(float pc,float pk)
        {
            ch=pc;
            k=pk;
        }
        float area()
        {
            return ch*k;
        }
};
class Trapezoid : public Shape
{   
    public:
        float shang;
        float xia;
        float gao;
        Trapezoid(float pshang,float pxia,float pgao)
        {
         shang=pshang;
         xia=pxia;
         gao=pgao;
        }
        float area()
        {
         return (shang+xia)*gao/2;
        }
};
class Triangle : public Shape
{ 
    public:
        float di;
        float sgao;
        Triangle(float pdi,float psgao)
        {
         di=pdi;
         sgao=psgao;
        }
        float area()
        {
         return di*sgao/2;
        }
};
int main()
{
    float  r;
    cin>>r;
    Circle  c(r);
    float e;
    cin>>e;
    Square s(e);
    float ch;
    float k;
    cin>>ch>>k;
    Rectangle re(ch,k);
    float shang;
    float xia;
    float gao;
    cin>>shang>>xia>>gao;
    Trapezoid tr(shang,xia,gao);
    float di;
    float sgao;
    cin>>di>>sgao;
    Triangle tri(di,sgao);

    Shape * a[5];
    a[0] = &c;
    a[1] = &s;
    a[2] = &re;
    a[3] = &tr;
    a[4] = &tri;
    float sum = 0.0;
    for(int i = 0; i<5; i++)
        sum = sum + a[i]->area();
    cout<<fixed<<setprecision(3)<<sum<<endl;
}